(function(){
	
	if (!window.CJ) {
		window.CJ = {};
	}

	function Banner () {
		this.name = 'Banner';
		this.bindEvent();
	}
	
	Banner.prototype = new EventCtl();
	Banner.prototype.bindEvent = function () {
		$('#global .aside li').on('click', function() {
			CJ.Scene.bannerDetail();
		});
		$('#global .aside li').on('mouseenter', function() {
			if(!CJ.isRightDetailEntry) {
				$('#global li').removeClass('focus');
				$('#global .aside li').removeClass('select focus');
				$(this).addClass('select focus');
				CJ.Scene.setDelegate(CJ.Scene["Banner"]);
			}
		});
	};
	Banner.prototype.up = function () {
		var now = $('#global .aside li.focus');
		var prev = now.prev();
		if (prev.length > 0 ) {
			now.removeClass('select focus');
			prev.addClass('select focus');
		} else {
			CJ.Scene.promotion();
		}
	};
	Banner.prototype.down = function () {
		var now = $('#global .aside li.focus');
		var next = now.next();
		if (next.length > 0 ) {
			now.removeClass('select focus');
			next.addClass('select focus');
		}
	};
	Banner.prototype.left = function () {
		$('#global .aside li').removeClass('focus');
		CJ.Scene.channel();
	};
	Banner.prototype.back = function () {
		$('#global .aside li').removeClass('focus');
		$("#pop").hide();
		$("#mask").hide();
		CJ.Scene.channel();
	};
	Banner.prototype.enter = function () {
		$('#global .aside li').removeClass('focus');
		$("#pop").hide();
		$("#mask").hide();
		CJ.Scene.bannerDetail();
	};
	
	function BannernDetail () {
		this.name = 'BannernDetail';
		this.bindEvent();
	}
	
	BannernDetail.prototype = new EventCtl();
	BannernDetail.prototype.bindEvent = function () {
	};
	BannernDetail.prototype.left = function () {
	};
	BannernDetail.prototype.right = function () {
	};
	BannernDetail.prototype.back = function () {
		CJ.Scene.banner();
	};
	BannernDetail.prototype.enter = function () {
	};

	$.extend(CJ.Scene, {
							banner: function(){
								$("#wrap").removeClass().addClass('ch');//vod 화면 전환
								$('#global li').removeClass('focus');
								if ( $('#global .aside li.select').addClass('focus').length <= 0) {
									$('#global .aside li:first-child').addClass('select focus');
								}
								$("#pop").hide();
								$("#mask").hide();
								this.setDelegate(this["Banner"]);
							},
							bannerDetail: function(){
								$("#wrap").removeClass().addClass('ch');//vod 화면 전환
								$('#global .aside li').removeClass('focus');
								$("#pop").show();
								$("#mask").show();
								this.setDelegate(this["BannernDetail"]);
							}
						});

	$(document).ready(function(){
		CJ.Scene["Banner"] = new Banner();
		CJ.Scene["BannernDetail"] = new BannernDetail();
	});

})();